<template>
  <div class="certificate-detail">
    <van-nav-bar :title="certificateDetail.certTitle" left-arrow :fixed="true" :placeholder="true" :z-index="999"
      :safe-area-inset-top="true" @click-left="goBack" />
    <div class="certificate-detail">
      <div class="certificate-center">
        <div class="img">
          <img :src="certificateDetail.certImage" alt="" v-if="certificateDetail.certImage" />
          <img :src="certificateDetail.coverImg" alt="" v-else />
          <div class="user-name" :class="{'column' : certificateDetail.styleType == 'colum'}">
            {{certificateDetail.userName}}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getCertificateDetails } from '@/api/certificate'
export default {
  name: 'certificateDetail',
  components: {  },
  data() {
    return {
      certificateId: this.$route.query.certificateId,
      certificateDetail: {}
    }
  },
  computed: {},
  mounted() {
    this.getCertificateDetails()
  },
  methods: {
    goBack() {
      this.$router.go(-1)
    },
    // 获取详情
    getCertificateDetails() {
      getCertificateDetails(this.certificateId).then(res => {
        if (res.code == '200') {
          this.certificateDetail = res.data
        }
      })
    }
  }
}
</script>

<style scoped lang="less">
.certificate-detail {
  width: 100%;
  box-sizing: border-box;

  .certificate-top {
    line-height: 40px;
    font-size: 14px;
    color: #333;
    font-weight: bold;
    text-align: center;
  }

  .certificate-center {
    width: 100%;
    padding: 10px 15px;
    box-sizing: border-box;

    .img {
      width: 100%;
      position: relative;

      img {
        width: 100%;
      }

      .user-name {
        position: absolute;
        top: 60px;
        width: 100%;
        text-align: center;
        font-size: 12px;
        color: #333;
        &.column{
          top: 140px;
          font-size: 14px;
        }
      }
    }
  }
}
</style>
